package cn.service.web;

import cn.service.entiy.User;
import cn.service.service.UserService;
import com.lmk.core.web.support.api.RequestResult;
import com.lmk.core.web.support.api.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("reg")
    public int reg(@RequestBody User user) {
        System.out.println(user.getAccount());
        return userService.regUser(user);
    }

    @PostMapping("login")
    public Boolean login(@RequestBody User user){
        return userService.login(user);
    }

    @PostMapping("getUser")
    public User getUser(@RequestBody Integer userId){
        return userService.getUserById(userId);
    }

}
